<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>{$head[title]}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta content="{$head[keywords]}" name="keywords" />
<meta content="{$head[description]}" name="description" />
<base href="{SITE_URL}" />
<link href="favicon.ico" rel="shortcut icon" />
<link href="../skin/style.css" rel="stylesheet" type="text/css" />
<link href="{SKIN_PATH}modal.css" rel="stylesheet" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="{$head[title]}" href="/rss.php?rssid={$catid}" />
<script language="JavaScript" src="misc/config.js"></script>
<script language="JavaScript" src="misc/jquery.min.js"></script>
<script language="JavaScript" src="misc/common.js"></script>
<script language="JavaScript" src="misc/validator.js"></script>

<script type="text/javascript" src="misc/validator.js"></script>
</head>
<body>

{template 'header.html'}

<div class="container">
	
    <div class="main">
    
    	
        <div class="mod">
            <div class="head">会员升级</div>
            <div class="body">
                
                <form action="?module=member&action=upgrade?action=pay&groupid={$groupid}" method="post" name="myform" onSubmit="return checkform()">
                    <input type="hidden" name="forward" value="{$forward}">
                    <table cellpadding="0" cellspacing="1" class="table_info"> 
                      <tr>
                        <th width="20%"><b>会员级别：</b></th>
                        <td>{$name}</td>
                      </tr>
                      <tr>
                        <th><b>会员资费：</b></th>
                        <td style="color:orange;font-weight:bold;">
                        {if $price_y>0}<input type="radio" name="unit" id="price_y" value="y" checked onClick="set_amount()"> 包年： {$price_y}{$unitname}/年<br />{/if}
                        {if $price_m>0}<input type="radio" name="unit" id="price_m" value="m" onClick="set_amount()"> 包月： {$price_m}{$unitname}/月<br />{/if}
                        {if $price_d>0}<input type="radio" name="unit" id="price_d" value="d" onClick="set_amount()"> 包日： {$price_d}{$unitname}/天<br />{/if}
                        </td>
                      </tr>
                      <tr>
                        <th><b>购买时限：</b></th>
                        <td><input type="text" name="number" id="number" value="1" size="3" maxlength="3" onBlur="set_amount()"> <span id="unitname">年</span></td>
                      </tr>
                      <tr>
                        <th><b>所需费用：</b></th>
                        <td style="color:red;font-weight:bold;"><span id="total">{$price_y}</span>{$unitname}</td>
                      </tr>
                       <tr>
                        <th><b>当前余额：</b></th>
                        <td><span style="color:blue;font-weight:bold;">{$balance}{$unitname}</span> <span id="pay"></span></td>
                      </tr>
                     <tr>
                        <th></th>
                        <td><input type="submit" name="dosubmit" value="立即升级"></td>
                      </tr>
                    </table>
                  </form>
      
            </div>
        </div> 
    </div>
    
    <div class="aside">
    	{template "left.html", "member"}
    </div>
</div>





<script type="text/javascript" src="misc/validator.js"></script>
<script type="text/javaScript">
var prices = Array();
prices['y'] = {$price_y};
prices['m'] = {$price_m};
prices['d'] = {$price_d};

$(function(){
   set_amount();
});
function checkform()
{
    set_amount();
	var unit = $("input[name=unit]:checked").val();
	var price = Math.abs(prices[unit]);
	var number = Math.abs($('#number').val());
	var total = price*number;
	if(total > {$balance})
	{
	    alert('余额不足，请先充值！');
		return false;
	}
	return true;
}

function set_amount()
{
	var unit = $("input[name=unit]:checked").val();
	var price = Math.abs(prices[unit]);
	var number = Math.abs($('#number').val());
	var total = price*number;
	$('#total').html(total);
	if($('#price_y').attr('checked') == true) $('#unitname').html('年');
	else if($('#price_m').attr('checked') == true) $('#unitname').html('月');
	else if($('#price_d').attr('checked') == true) $('#unitname').html('天');
	if(total > {$balance})
	{
	    {if $M['paytype'] == 'amount'}
	       var payurl = '?module=pay&file=showpayment&action=type&pay=online&amount='+(total > {$balance});
		{else}
	       var payurl = '?module=pay&file=showpayment&action=buypoint';
		{/if}
	    $('#pay').html('您的余额不足，请<a href="'+payurl+'" style="color:red;">点击这里充值</a>！');
		return false;
	}
	else
	{
	    $('#pay').html('');
		return true;
	}
}
</script>
{template "footer.html"}